home *** CD-ROM | disk | FTP | other *** search
- #==============================================================================
- # prim.test
- #------------------------------------------------------------------------------
- # Test of the Tcl SIPP primitive object creation commands.
- #------------------------------------------------------------------------------
- # Copyright 1992 Mark Diekhans
- # Permission to use, copy, modify, and distribute this software and its
- # documentation for any purpose and without fee is hereby granted, provided
- # that the above copyright notice appear in all copies. Mark Diekhans makes
- # no representations about the suitability of this software for any purpose.
- # It is provided "as is" without express or implied warranty.
- #------------------------------------------------------------------------------
- # $Id: prim.test,v 2.0 1992/11/02 03:56:00 markd Rel $
- #==============================================================================
-
- if {[info procs test] == ""} {source testprocs.tcl}
-
- #
- # Test setup.
- #
-
- test {primitive-1.1} {
- set shader1 [SippShaderBasic .5 .8 .2 {.2 .5 .8}]
- crange $shader1 0 5
- } 0 {shader}
-
- #
- # Test SippTorus command.
- #
-
- test {primitive-2.1} {
- SippTorus
- } 1 {wrong # args: SippTorus bigradius smallradius radialres tuberes shaderhandle [texture]}
-
- test {primitive-2.2} {
- SippTorus 1.1 0.3 1 1 foo
- } 1 {invalid shader handle: foo}
-
- test {primitive-2.3} {
- SippTorus 1.1 0.3 1 1 $shader1 foo
- } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
-
- test {primitive-2.4} {
- SippTorus 1.1 0.3 1.2 1 $shader1
- } 1 {expected unsigned integer but got "1.2"}
-
- test {primitive-2.5} {
- catch {unset object}
- set object [SippTorus 1.0 .5 3 4 $shader1]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- test {primitive-2.6} {
- catch {unset object}
- set object [SippTorus 1.0 .5 3 4 $shader1 NATURAL]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- #
- # Test SippCone command.
- #
-
- test {primitive-3.1} {
- SippCone
- } 1 {wrong # args: SippCone bottomgradius topradius length resolution shaderhandle [texture]}
-
- test {primitive-3.2} {
- SippCone 1.1 0.3 1 1 foo
- } 1 {invalid shader handle: foo}
-
- test {primitive-3.3} {
- SippCone 1.1 0.3 1 1 $shader1 foo
- } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
-
- test {primitive-3.4} {
- SippCone 1.1 0.3 1.2 1.9 $shader1
- } 1 {expected unsigned integer but got "1.9"}
-
- test {primitive-3.5} {
- catch {unset object}
- set object [SippCone 10.0 1.0 22 10 $shader1]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- test {primitive-3.6} {
- catch {unset object}
- set object [SippCone 10.0 1.0 22 10 $shader1 CYLINDRICAL]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- #
- # Test SippCylinder command.
- #
-
- test {primitive-4.1} {
- SippCylinder
- } 1 {wrong # args: SippCylinder radius length resolution shaderhandle [texture]}
-
- test {primitive-4.2} {
- SippCylinder 2.5 1 3 foo
- } 1 {invalid shader handle: foo}
-
- test {primitive-4.3} {
- SippCylinder 2.5 1 3 $shader1 foo
- } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
-
- test {primitive-4.4} {
- SippCylinder 2.5 1 3.5 $shader1
- } 1 {expected unsigned integer but got "3.5"}
-
- test {primitive-4.5} {
- catch {unset object}
- set object [SippCylinder 10.11 20.4 15 $shader1]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- test {primitive-4.6} {
- catch {unset object}
- set object [SippCylinder 10.11 20.4 15 $shader1 SPHERICAL]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- #
- # Test SippEllipsoid command.
- #
-
- test {primitive-5.1} {
- SippEllipsoid
- } 1 {wrong # args: SippEllipsoid {xradius yradius zradius} resolution shaderhandle [texture]}
-
- test {primitive-5.2} {
- SippEllipsoid {1.0 2.5 1.6} 4 foo
- } 1 {invalid shader handle: foo}
-
- test {primitive-5.3} {
- SippEllipsoid {1.0 2.5 1.6} 4 $shader1 foo
- } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
-
- test {primitive-5.4} {
- SippEllipsoid {1.0 2.5 1.6} 6.7 $shader1
- } 1 {expected unsigned integer but got "6.7"}
-
- test {primitive-5.5} {
- catch {unset object}
- set object [SippEllipsoid {1.0 3.5 6.2} 1 $shader1]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- test {primitive-5.6} {
- catch {unset object}
- set object [SippEllipsoid {1.0 3.5 6.2} 1 $shader1 WORLD]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- #
- # Test SippSphere command.
- #
-
- test {primitive-6.1} {
- SippSphere
- } 1 {wrong # args: SippSphere radius resolution shaderhandle [texture]}
-
- test {primitive-6.2} {
- SippSphere 1.1 1 foo
- } 1 {invalid shader handle: foo}
-
- test {primitive-6.3} {
- SippSphere 1.1 1 $shader1 foo
- } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
-
- test {primitive-6.4} {
- SippSphere 1.1 1.9 $shader1
- } 1 {expected unsigned integer but got "1.9"}
-
- test {primitive-6.5} {
- catch {unset object}
- set object [SippSphere 10.2 10 $shader1]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- test {primitive-6.6} {
- catch {unset object}
- set object [SippSphere 10.2 10 $shader1 NATURAL]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- #
- # Test SippBlock command.
- #
-
- test {primitive-7.1} {
- SippBlock
- } 1 {wrong # args: SippBlock {xsize ysize zsize} shaderhandle [texture]}
-
- test {primitive-7.2} {
- SippBlock {1.3 4.5 7.9} foo
- } 1 {invalid shader handle: foo}
-
- test {primitive-7.3} {
- SippBlock {1.3 4.5 7.9} $shader1 foo
- } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
-
- test {primitive-7.4} {
- SippBlock {4.5 x43 7.9} $shader1
- } 1 {expected floating-point number but got "x43"}
-
- test {primitive-7.5} {
- catch {unset object}
- set object [SippBlock {1.0 20.2 10.1} $shader1]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- test {primitive-7.6} {
- catch {unset object}
- set object [SippBlock {1.0 20.2 10.1} $shader1 CYLINDRICAL]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- #
- # Test SippCube command.
- #
-
- test {primitive-8.1} {
- SippCube
- } 1 {wrong # args: SippCube size shaderhandle [texture]}
-
- test {primitive-8.2} {
- SippCube 1.3 foo
- } 1 {invalid shader handle: foo}
-
- test {primitive-8.3} {
- SippCube 1.3 $shader1 foo
- } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
-
- test {primitive-8.4} {
- SippCube x43 $shader1
- } 1 {expected floating-point number but got "x43"}
-
- test {primitive-8.5} {
- catch {unset object}
- set object [SippCube 1.11 $shader1]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- test {primitive-8.6} {
- catch {unset object}
- set object [SippCube 1.11 $shader1 SPHERICAL]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- #
- # Test SippPrism command.
- #
-
- set 2dlist {{1 1} {2 2} {3 3} {4 4} {5 5}}
-
- test {primitive-9.1} {
- SippPrism
- } 1 {wrong # args: SippPrism 2dpointlist length shaderhandle [texture]}
-
- test {primitive-9.2} {
- SippPrism $2dlist 10 foo
- } 1 {invalid shader handle: foo}
-
- test {primitive-9.3} {
- SippPrism $2dlist 10 $shader1 foo
- } 1 {expected one of "NATURAL", "CYLINDRICAL", "SPHERICAL", or "WORLD", got "foo"}
-
- test {primitive-9.4} {
- SippPrism $2dlist x43 $shader1
- } 1 {expected floating-point number but got "x43"}
-
- test {primitive-9.5} {
- SippPrism {1 2 3} 10 $shader1
- } 1 {a 2D point must be a list of two elements}
-
- test {primitive-9.6} {
- SippPrism {{1 2} 3} 10 $shader1
- } 1 {2d point list must contain at least 3 points}
-
- test {primitive-9.7} {
- catch {unset object}
- set object [SippPrism $2dlist 10 $shader1]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- test {primitive-9.8} {
- catch {unset object}
- set object [SippPrism $2dlist 10 $shader1 SPHERICAL]
- SippObjectDelete $object
- crange $object 0 5
- } 0 {object}
-
- #
- # Cleanup.
- #
-
- test {primitive-9.1} {
- SippShaderDelete $shader1
- } 0 {}
-
-